#include <iostream>
#include <stack>
#include <string>

using namespace std;

int main() {
    string s;
    getline(cin, s);

    stack<char> st;
    string aa = "([{<";
    string bb = ")]}>";

    for (int i = 0; i < s.size(); ++i) {
        char c = s[i];
        if (aa.find(c) != string::npos) {
            st.push(c);
        } else if (bb.find(c) != string::npos) {
            if (st.empty() || bb[aa.find(st.top())] != c) {
                cout << "False" << endl;
                return 0;
            }
            st.pop();
        }
    }

    cout << (st.empty() ? "True" : "False") << endl;

    return 0;
}
